package com.own.core.object.todo;

import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import com.own.core.html.form.dateField.DateField;
import com.own.core.html.form.dropDown.DropDown;
import com.own.core.html.form.textArea.TextArea;
import com.own.core.html.form.textField.TextField;
import com.own.core.object.Dao;
import com.own.core.util.OwnDate;
import com.own.core.util.ToDoStatus;

@Entity
@Table(name = "core_todo")
public class ToDo extends Dao {
	private long id;

	@TextField(required = true, list = true)
	private String taskName;

	@TextArea(list = true)
	private String taskDetails;
	
	@DropDown 
	private ToDoStatus toDoStatus;
	
	@DateField 
	private OwnDate startDate;
	
	@DateField 
	private OwnDate endDate;
	
	
	@Id
	@GeneratedValue(strategy = GenerationType.TABLE)
	public long getId() {

		return id;
	}
	
	@Transient
	public String getName() {

		return taskName;
	}
	
	

	public String getTaskName() {
		return taskName;
	}

	public void setTaskName(String taskName) {
		this.taskName = taskName;
	}

	public String getTaskDetails() {
		return taskDetails;
	}

	public void setTaskDetails(String taskDetails) {
		this.taskDetails = taskDetails;
	}

	public ToDoStatus getToDoStatus() {
		return toDoStatus;
	}

	public void setToDoStatus(ToDoStatus toDoStatus) {
		this.toDoStatus = toDoStatus;
	}

	@Basic
	@Temporal(TemporalType.DATE)
	public Date getStartDate() {
		
		return startDate;
	}

	public void setStartDate(OwnDate startDate) {
 
		this.startDate = startDate;
		
	}
	
	public void setStartDate(Date startDate) {
		if (startDate == null) {
			startDate = null;

		} else {
			this.startDate = new OwnDate(startDate);
		}
	 
		
	}
	@Basic
	@Temporal(TemporalType.DATE)
	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(OwnDate endDate) {
		this.endDate = endDate;
	}
	public void setEndDate( Date endDate) {
		if (endDate == null) {
			endDate = null;

		} else {
			this.endDate = new OwnDate(endDate);
		}
	 
	}

	public void setId(long id) {
		this.id = id;
	}


	
}
